package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class ContactAdd extends TestBase {

	@Test(dataProvider = "randomValidContactGenegator")
	public void NonEmptyContactAdd(ContactData contact) throws Exception {

//		app.navigatiTo().mainPage();
//		app.getContactHelper().addNewContact();
		// save state
		SortedListOf<ContactData> oldList = app.getContactHelper()
				.getContacts();
		app.getContactHelper().createContact(contact);
		// new state
		SortedListOf<ContactData> newList = app.getContactHelper()
				.getContacts();
		// compare old vs new
		assertThat(newList, equalTo(oldList.withAdded(contact)));

	}

}